<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.10.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>common_util: src/common_util/timeutil.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">common_util
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.10.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_2961cad218251a7c35c6867350b80887.html">common_util</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">timeutil.h</div></div>
</div><!--header-->
<div class="contents">
<a href="timeutil_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno">   19</span><span class="preprocessor">#pragma once</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno">   20</span> </div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span><span class="preprocessor">#include &lt;cstdint&gt;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span> </div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span><span class="keyword">namespace </span>cutl</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span>{</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span> </div>
<div class="foldopen" id="foldopen00030" data-start="{" data-end="};">
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"><a class="line" href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1">   30</a></span>    <span class="keyword">enum class</span> <a class="code hl_enumeration" href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1">timeunit</a></div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno">   31</span>    {</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno">   33</span>        <a class="code hl_enumvalue" href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1a03c7c0ace395d80182db07ae2c30f034">s</a>,</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno">   35</span>        <a class="code hl_enumvalue" href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1aee33e909372d935d190f4fcb2a92d542">ms</a>,</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno">   37</span>        <a class="code hl_enumvalue" href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1a0b3b97fa66886c5688ee4ae80ec0c3c2">us</a>,</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno">   38</span>    };</div>
</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span> </div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"><a class="line" href="timeutil_8h.html#a2a99e9f55412f069169e60623ba1964a">   46</a></span>    uint64_t <a class="code hl_function" href="timeutil_8h.html#a2a99e9f55412f069169e60623ba1964a">timestamp</a>(<a class="code hl_enumeration" href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1">timeunit</a> unit);</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"><a class="line" href="timeutil_8h.html#a138f4ea5f89d12e1660b79877e8d5aa8">   53</a></span>    uint64_t <a class="code hl_function" href="timeutil_8h.html#a138f4ea5f89d12e1660b79877e8d5aa8">clocktime</a>(<a class="code hl_enumeration" href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1">timeunit</a> unit);</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno">   54</span> </div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"><a class="line" href="timeutil_8h.html#aa6801f26864882bbce8e3aa2b3e58d4a">   61</a></span>    uint64_t <a class="code hl_function" href="timeutil_8h.html#aa6801f26864882bbce8e3aa2b3e58d4a">ms2s</a>(uint64_t time);</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"><a class="line" href="timeutil_8h.html#ae200cc5e60d5eb1a706040cb77af8a61">   68</a></span>    uint64_t <a class="code hl_function" href="timeutil_8h.html#ae200cc5e60d5eb1a706040cb77af8a61">us2s</a>(uint64_t time);</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"><a class="line" href="timeutil_8h.html#aa22680f091e52ed6709aaa5c71be7da9">   75</a></span>    uint64_t <a class="code hl_function" href="timeutil_8h.html#aa22680f091e52ed6709aaa5c71be7da9">us2ms</a>(uint64_t time);</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"><a class="line" href="timeutil_8h.html#a8b63bc9d427d2c83faac20de68b143b7">   82</a></span>    uint64_t <a class="code hl_function" href="timeutil_8h.html#a8b63bc9d427d2c83faac20de68b143b7">s2ms</a>(uint64_t time);</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"><a class="line" href="timeutil_8h.html#af9eb8483ea0d5f2062f6fda8abfbe109">   89</a></span>    uint64_t <a class="code hl_function" href="timeutil_8h.html#af9eb8483ea0d5f2062f6fda8abfbe109">s2us</a>(uint64_t time);</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"><a class="line" href="timeutil_8h.html#a4c3160c938fa506c2383a3dc976c3fdc">   96</a></span>    uint64_t <a class="code hl_function" href="timeutil_8h.html#a4c3160c938fa506c2383a3dc976c3fdc">ms2us</a>(uint64_t time);</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span> </div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno">   98</span>} <span class="comment">// namespace</span></div>
<div class="ttc" id="atimeutil_8h_html_a138f4ea5f89d12e1660b79877e8d5aa8"><div class="ttname"><a href="timeutil_8h.html#a138f4ea5f89d12e1660b79877e8d5aa8">cutl::clocktime</a></div><div class="ttdeci">uint64_t clocktime(timeunit unit)</div><div class="ttdoc">Get current clock time for monotone increment time.</div></div>
<div class="ttc" id="atimeutil_8h_html_a2a99e9f55412f069169e60623ba1964a"><div class="ttname"><a href="timeutil_8h.html#a2a99e9f55412f069169e60623ba1964a">cutl::timestamp</a></div><div class="ttdeci">uint64_t timestamp(timeunit unit)</div><div class="ttdoc">Get current timestamp.</div></div>
<div class="ttc" id="atimeutil_8h_html_a4c3160c938fa506c2383a3dc976c3fdc"><div class="ttname"><a href="timeutil_8h.html#a4c3160c938fa506c2383a3dc976c3fdc">cutl::ms2us</a></div><div class="ttdeci">uint64_t ms2us(uint64_t time)</div><div class="ttdoc">Convert time from milliseconds to microseconds.</div></div>
<div class="ttc" id="atimeutil_8h_html_a5123cf2b94c1fabe15fb9ba61231d5f1"><div class="ttname"><a href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1">cutl::timeunit</a></div><div class="ttdeci">timeunit</div><div class="ttdoc">Time unit enum.</div><div class="ttdef"><b>Definition</b> timeutil.h:31</div></div>
<div class="ttc" id="atimeutil_8h_html_a5123cf2b94c1fabe15fb9ba61231d5f1a03c7c0ace395d80182db07ae2c30f034"><div class="ttname"><a href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1a03c7c0ace395d80182db07ae2c30f034">cutl::timeunit::s</a></div><div class="ttdeci">@ s</div></div>
<div class="ttc" id="atimeutil_8h_html_a5123cf2b94c1fabe15fb9ba61231d5f1a0b3b97fa66886c5688ee4ae80ec0c3c2"><div class="ttname"><a href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1a0b3b97fa66886c5688ee4ae80ec0c3c2">cutl::timeunit::us</a></div><div class="ttdeci">@ us</div></div>
<div class="ttc" id="atimeutil_8h_html_a5123cf2b94c1fabe15fb9ba61231d5f1aee33e909372d935d190f4fcb2a92d542"><div class="ttname"><a href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1aee33e909372d935d190f4fcb2a92d542">cutl::timeunit::ms</a></div><div class="ttdeci">@ ms</div></div>
<div class="ttc" id="atimeutil_8h_html_a8b63bc9d427d2c83faac20de68b143b7"><div class="ttname"><a href="timeutil_8h.html#a8b63bc9d427d2c83faac20de68b143b7">cutl::s2ms</a></div><div class="ttdeci">uint64_t s2ms(uint64_t time)</div><div class="ttdoc">Convert time from seconds to microseconds.</div></div>
<div class="ttc" id="atimeutil_8h_html_aa22680f091e52ed6709aaa5c71be7da9"><div class="ttname"><a href="timeutil_8h.html#aa22680f091e52ed6709aaa5c71be7da9">cutl::us2ms</a></div><div class="ttdeci">uint64_t us2ms(uint64_t time)</div><div class="ttdoc">Convert time from seconds to milliseconds.</div></div>
<div class="ttc" id="atimeutil_8h_html_aa6801f26864882bbce8e3aa2b3e58d4a"><div class="ttname"><a href="timeutil_8h.html#aa6801f26864882bbce8e3aa2b3e58d4a">cutl::ms2s</a></div><div class="ttdeci">uint64_t ms2s(uint64_t time)</div><div class="ttdoc">Convert time from milliseconds to seconds.</div></div>
<div class="ttc" id="atimeutil_8h_html_ae200cc5e60d5eb1a706040cb77af8a61"><div class="ttname"><a href="timeutil_8h.html#ae200cc5e60d5eb1a706040cb77af8a61">cutl::us2s</a></div><div class="ttdeci">uint64_t us2s(uint64_t time)</div><div class="ttdoc">Convert time from microseconds to seconds.</div></div>
<div class="ttc" id="atimeutil_8h_html_af9eb8483ea0d5f2062f6fda8abfbe109"><div class="ttname"><a href="timeutil_8h.html#af9eb8483ea0d5f2062f6fda8abfbe109">cutl::s2us</a></div><div class="ttdeci">uint64_t s2us(uint64_t time)</div><div class="ttdoc">Convert time from seconds to microseconds.</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
</small></address>
</body>
</html>
